Don't reclaim vcpus that are not put into use yet when destroying HVM
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sun, 26 Mar 2006 10:43:53 +0000 (11:43 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sun, 26 Mar 2006 10:43:53 +0000 (11:43 +0100)
domain. Otherwise, when running a debug=y xen, we will get a assertion
failure in vmx_request_clear_vmcs(), since some vcpus may be not
initialized for HVM use yet.

Signed-off-by: Xin Li <xin.b.li@intel.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c

index 22a5bcb41830900e1b2cf0b3553ddfa3846fe592..ea4138f856e55d78b02d8ee98b1c2694fdbc3eec 100644 (file)
@@ -728,6 +728,8 @@ static void svm_relinquish_guest_resources(struct domain *d)
 
     for_each_vcpu ( d, v )
     {
+        if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) )
+            continue;
 #if 0
         /* Memory leak by not freeing this. XXXKAF: *Why* is not per core?? */
         free_host_save_area(v->arch.hvm_svm.host_save_area);
index 1c1a9fb8fa89f3f1d2f230548353a0bf0ee07267..9e146477cc906af4d198907cd356c76abbe53cbb 100644 (file)
@@ -89,6 +89,8 @@ static void vmx_relinquish_guest_resources(struct domain *d)
 
     for_each_vcpu ( d, v )
     {
+        if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) )
+            continue;
         vmx_request_clear_vmcs(v);
         destroy_vmcs(&v->arch.hvm_vmx);
         free_monitor_pagetable(v);